QuickTime 3 Reference

Previous | Chapter Top | Chapter Contents | Next

Setting Properties of the Sprite Track

In addition to adding key frame samples and override samples to the sprite track, you may want to set one or more global properties of the sprite track. For example, if you want to define a background color for your sprite track, you must set the sprite track's background color property. You do this by creating a leaf atom of type kSpriteTrackPropertyBackgroundColor whose data is the desired background color.

After adding the override samples, AddSpriteTrackToMovie adds a background color to the sprite track, as shown in Listing 11 . If the withBackgroundPicture parameter is false, this function defines a solid background color for the sprite track. The function calls QTNewAtomContainer to create a new atom container for sprite track properties. AddSpriteTrackToMovie adds a new atom of type kSpriteTrackPropertyBackgroundColor to the container and calls SetMediaPropertyAtom to set the sprite track's properties.

Listing 11 Defining a background color

// add a background color to the sprite track
if (withBackgroundPicture == false)
{
    QTAtomContainer trackProperties;
    RGBColor backgroundColor;

    backgroundColor.red = 0x8000;
    backgroundColor.green = 0;
    backgroundColor.blue = 0xffff;

    // create a new atom container for sprite track properties
    QTNewAtomContainer (&trackProperties);

    // add an atom for the background color property
    QTInsertChild (trackProperties, 0,
        kSpriteTrackPropertyBackgroundColor, 1, 1, sizeof(RGBColor),
        &backgroundColor, nil);

    // set the sprite track's properties
    err = SetMediaPropertyAtom (newMedia, trackProperties);

    QTDisposeAtomContainer(trackProperties);
}

© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next